package edu.sctu.practice.class01.nieyu.assign03.assign03_2;

/**
 * Created by Administrator on 2015/10/22.
 */
public class ComparableCylinder extends Cylinder implements Comparable {

    @Override
    public int compareTo(Object o) {

        if(getLength()>((Cylinder) o).getLength())

            return 1;
        else if (getLength() < ((Cylinder) o).getLength())

            return -1;
        else
            return 0;
    }

    public ComparableCylinder(double length){

        super(length);
    }
}
